'use strict';

module.exports = function collectSameElements(collectionA, objectB) {
  let result=[];
  let newarray=[];
  for(let value of objectB.value){
    newarray.push(value);
  }
  for(let i=0;i<collectionA.length;i++){
    for(let n=0;n<newarray.length;n++){
      if(collectionA[i]==newarray[n]){
        result.push(collectionA[i]);
      }
    }
 } 
  return result;
}
